#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct edge {
    int to;
    int weight;
};

int n;
vector<bool> vi;
vector<int> dis;
vector<vector<edge>> graph{{}, {}, {{1, 1}, {3, 1}}, {{4, 1}}, {}};

void dijkstra(int n) {
    dis[2] = 0;
    for (int i = 1; i <= n; i++) {
        int minV = -1;
        int minW = 0x3f3f3f3f;
        for (int j = 1; j <= n; j++) {
            if (!vi[j] && dis[j] < minW) {
                minV = j;
                minW = dis[j];
            }
        }
        if (minV == -1) return;
        vi[minV] = 1;
        for (int j = 0; j < graph[minV].size(); j++) {
            if (!vi[graph[minV][j].to] &&
                dis[minV] + graph[minV][j].weight < dis[graph[minV][j].to]) {
                dis[graph[minV][j].to] = dis[minV] + graph[minV][j].weight;
            }
        }
    }
}

int main() {
    cin >> n;
    dis.resize(n + 1, 0x3f3f3f3f);
    vi.resize(n + 1, 0);
    dijkstra(n);
    for (int i = 1; i <= n; i++) cout << dis[i] << " ";
    return 0;
}